// vue3插件形式注册全局组件

import Skeleton from './Skeleton'
import Slider from './Slider'
import More from './More'

// 面包屑有两个组件
import Bread from './Bread'
import BreadItem from './Bread/item'

import InfiniteLoad from './InfiniteLoad'

import City from './City'

import Sku from './Sku'

import NumberBox from './NumberBox'

import Button from './Button'

import CheckBox from './CheckBox'

import Message from './Message/index.vue'

// 优化重复注册全局组件--循环注册
// 1.组件放入数组 2.循环数组并注册
const cps = [Skeleton, Slider, More, Bread, BreadItem, InfiniteLoad, City, Sku, NumberBox, Button, CheckBox, Message]

export default {
  // vue2参数是Vue(构造函数)
  install (app) {
    // vue3参数是app实例

    // 重复注册
    // app.component(Skeleton.name, Skeleton)
    // app.component(Slider.name, Slider)

    // 优化注册
    cps.forEach(cp => {
      app.component(cp.name, cp)
    })
  }
}
